home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / man / oldman3 / Range.3T < prev    next >
Text File  |  1992-06-26  |  3KB  |  89 lines

  1. .TH RANGE
  2. .SH NAME
  3. Range
  4.  <Type,lbound,hbound> 
  5.  A parameterized range
  6. .SH SYNOPSIS
  7.  #include <cool/Range.h>
  8. .SH DESCRIPTION
  9. The \f3Range<Type,lbound,hbound>\f1 class is publicly derived from the 
  10.  Range 
  11. class 
  12. and supports user-defined ranges for a type of object or built-in data type. 
  13. This allows other higher level data structures such as the 
  14.  Rational 
  15. and 
  16.  Complex 
  17. classes to be restricted to a range of values. The programmer does not have to 
  18. add bounds-checking code to the application. A vector of positive integers, for 
  19. example, would be easy to declare, facilitating bounds checking restricted to 
  20. the code that implements the type, not the vector.
  21. .PP
  22. The inclusive low and high bounds for the range are specified as arguments to 
  23. the parameterized type declaration and implementation macro calls. They are 
  24. declared as \f3C++\f1 constants of the appropriate type. No storage is allocated, and 
  25. all references are compiled out by the compiler. Once declared, a 
  26. \f3Range<Type,lbound,hbound>\f1 object cannot have its upper or lower bounds changed 
  27. because maintenance of all instances would require significant and unwarranted 
  28. overhead.
  29. .SH Base Classes
  30.  Range
  31. .SH Friend Classes
  32. None
  33. .SH Constructors
  34. .TP
  35. \f3Range<Type,lbound,hbound> ();\f1
  36. Creates an empty range object of the specified type and ranges.
  37. .TP
  38. \f3Range<Type,lbound,hbound> (const  Type& \f2value\f3);\f1
  39. Creates a range object with the specified value. If 
  40.  value 
  41. is outside of the 
  42. lower and upper bounds, an \f3\f3Error\f1\f1 exception is raised.
  43. .TP
  44. \f3Range<Type,lbound,hbound> (const   Range<Type,lbound,hbound>& \f2r\f3);\f1
  45. Creates a new range object with the same value as the range object \f2r\f1.
  46. .SH Member Functions
  47. .TP
  48.  inline const Type& high () const;
  49. Returns a reference to the upper limit of the range.
  50. .TP
  51.  inline const Type& low () const;
  52. Returns a reference to the lower limit of the range.
  53. .TP
  54. \f3inline Range<Type,lbound,hbound>& operator= (const Range<Type,lbound,hbound>& \f2r\f3);\f1
  55. Overloads the assignment operator for the \f3Range<Type,lbound,hbound>\f1 class and 
  56. assigns the range object the value of \f2r\f1. This function returns a reference to the updated object.
  57. .TP
  58. \f3inline void set (const Type& \f2value\f3);\f1
  59. Sets the value of the range object to 
  60.  value 
  61. if within the lower and upper 
  62. limits; otherwise, this function raises an 
  63.  \f3\f3Error\f1\f1 
  64. exception.
  65. .TP
  66. \f3inline void set_compare (Range_Compare \f2r_fcn\f3);\f1
  67. Sets the compare function for this class of \f3Range<Type,lbound,hbound>\f1. 
  68.  Range_Compare 
  69. is a function of type 
  70.  int 
  71. (\f2*Function\f1)
  72. \f3(const Type&\f1, \f3const Type&\f1).
  73. .TP
  74.  inline operator Type () const;
  75. Overloads the implicit conversion operator for the parameterized type to 
  76. facilitate mixed-type expressions and statements.
  77. .SH COPYRIGHT
  78.  
  79. Copyright (C) 1991 Texas Instruments Incorporated.
  80.  
  81. Permission is granted to any individual or institution to use, copy, modify,
  82. and distribute this software, provided that this complete copyright and
  83. permission notice is maintained, intact, in all copies and supporting
  84. documentation.
  85.  
  86. Texas Instruments Incorporated provides this software "as is" without
  87. express or implied warranty.
  88.  
  89.